package com.hxkj.service.article.impl;

import com.hxkj.client.service.MqInfoServiceClient;
import com.hxkj.domain.po.MqInfo;
import com.hxkj.service.article.MqInfoService;
import com.platform.common.domain.result.ParameterDataStruct;
import com.platform.common.domain.result.ResultPageStruct;
import com.platform.common.domain.to.PageTo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 *  @desc mq消息队列管理界面
 *  @author yaosy
 *  @date 2018年9月6日15:04:31
 * **/
@Service
@Slf4j
public class MqInfoServiceImpl implements MqInfoService {

    @Autowired
    private MqInfoServiceClient mqInfoServiceClient;

    @Override
    public ResultPageStruct<MqInfo> getMqInfoList(MqInfo mqInfo, PageTo pageParam) {
        ResultPageStruct<MqInfo> result = new ResultPageStruct<>();
        try{
            if (pageParam.getPageNum() == null || pageParam.getPageSize() == null) {
                pageParam.setPageNum(1);
                pageParam.setPageSize(10);
            }
            ParameterDataStruct<MqInfo> parameterDataStruct = new ParameterDataStruct<>();
            parameterDataStruct.setData(mqInfo);
            parameterDataStruct.setPageTo(pageParam);
            result = mqInfoServiceClient.getMqInfoList(parameterDataStruct);
        }catch (Exception e){
            e.printStackTrace();
        }
        result.setCode(null);
        result.setMessage(null);
        return result;
    }
}
